package edu.sctu.practice.class01.wulixia.month09_wlx.assign03.three;

/**
 * Created by wulixia on 2015/11/5.
 * （3）	创建CloneableCircle类，CloneableCircle类是Circle类的子类，
 * 并实现了Cloneable接口。要求CloneableCircle类中有一个
 * Name类型的数据成员creator，代表圆对象的创建者姓名。
 */
class CloneableCircle extends Circle implements Cloneable {

    private Name creator = new Name("Yong", "D", "Liang");

    public CloneableCircle(double radius) {
        super(radius);
    }

    public Name getCreator() {
        return creator;
    }

    public void setCreator(Name name) {
        creator = name;
    }

    public Object clone() {

        Object o = null;

        try {
            o = (CloneableCircle) super.clone();
        } catch (CloneNotSupportedException ex) {
            return null;
        }

        return o;
    }

    public String toString() {
        return super.toString() + " " + creator.getFullname();
    }
}

